home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 26.zip / BS1 part 26 / Aztec C v5.2a disk 4.adf / 204inc_h.lzh / devices / prtbase.h < prev    next >
C/C++ Source or Header  |  1991-03-14  |  6KB  |  170 lines

  1. #ifndef  DEVICES_PRTBASE_H
  2. #define  DEVICES_PRTBASE_H
  3. /*
  4. **    $Filename: devices/prtbase.h $
  5. **    $Release: 2.04 $
  6. **    $Revision: 1.10 $
  7. **    $Date: 90/11/02 $
  8. **
  9. **    printer.device base structure definitions
  10. **
  11. **    (C) Copyright 1987, 1988,1989, 1990 Commodore-Amiga, Inc.
  12. **        All Rights Reserved
  13. */
  14.  
  15. #ifndef  EXEC_TYPES_H
  16. #include "exec/types.h"
  17. #endif
  18. #ifndef  EXEC_NODES_H
  19. #include "exec/nodes.h"
  20. #endif
  21. #ifndef  EXEC_LISTS_H
  22. #include "exec/lists.h"
  23. #endif
  24. #ifndef  EXEC_PORTS_H
  25. #include "exec/ports.h"
  26. #endif
  27. #ifndef  EXEC_LIBRARIES_H
  28. #include "exec/libraries.h"
  29. #endif
  30. #ifndef  EXEC_TASKS_H
  31. #include "exec/tasks.h"
  32. #endif
  33.  
  34. #ifndef  DEVICES_PARALLEL_H
  35. #include "devices/parallel.h"
  36. #endif
  37. #ifndef  DEVICES_SERIAL_H
  38. #include "devices/serial.h"
  39. #endif
  40. #ifndef  DEVICES_TIMER_H
  41. #include "devices/timer.h"
  42. #endif
  43. #ifndef  LIBRARIES_DOSEXTENS_H
  44. #include "libraries/dosextens.h"
  45. #endif
  46. #ifndef  INTUITION_INTUITION_H
  47. #include "intuition/intuition.h"
  48. #endif
  49.  
  50.  
  51. struct DeviceData {
  52.     struct Library dd_Device; /* standard library node */
  53.     APTR dd_Segment;          /* A0 when initialized */
  54.     APTR dd_ExecBase;          /* A6 for exec */
  55.     APTR dd_CmdVectors;       /* command table for device commands */
  56.     APTR dd_CmdBytes;          /* bytes describing which command queue */
  57.     UWORD   dd_NumCommands;   /* the number of commands supported */
  58. };
  59.  
  60. #define P_OLDSTKSIZE    0x0800    /* stack size for child task (OBSOLETE) */
  61. #define P_STKSIZE    0x1000    /* stack size for child task */
  62. #define P_BUFSIZE    256    /* size of internal buffers for text i/o */
  63. #define P_SAFESIZE    128    /* safety margin for text output buffer */
  64.  
  65. struct     PrinterData {
  66.     struct DeviceData pd_Device;
  67.     struct MsgPort pd_Unit;    /* the one and only unit */
  68.     BPTR pd_PrinterSegment;    /* the printer specific segment */
  69.     UWORD pd_PrinterType;    /* the segment printer type */
  70.                 /* the segment data structure */
  71.     struct PrinterSegment *pd_SegmentData;
  72.     UBYTE *pd_PrintBuf;    /* the raster print buffer */
  73.     int (*pd_PWrite)();    /* the write function */
  74.     int (*pd_PBothReady)();    /* write function's done */
  75.     union {            /* port I/O request 0 */
  76.         struct IOExtPar pd_p0;
  77.         struct IOExtSer pd_s0;
  78.     } pd_ior0;
  79.  
  80. #define  pd_PIOR0 pd_ior0.pd_p0
  81. #define  pd_SIOR0 pd_ior0.pd_s0
  82.  
  83.     union {            /*   and 1 for double buffering */
  84.         struct IOExtPar pd_p1;
  85.         struct IOExtSer pd_s1;
  86.     } pd_ior1;
  87.  
  88. #define  pd_PIOR1 pd_ior1.pd_p1
  89. #define  pd_SIOR1 pd_ior1.pd_s1
  90.  
  91.     struct timerequest pd_TIOR;    /* timer I/O request */
  92.     struct MsgPort pd_IORPort;    /* and message reply port */
  93.     struct Task pd_TC;        /* write task */
  94.     UBYTE pd_OldStk[P_OLDSTKSIZE];    /* and stack space (OBSOLETE) */
  95.     UBYTE pd_Flags;            /* device flags */
  96.     UBYTE pd_pad;            /* padding */
  97.     struct Preferences pd_Preferences;    /* the latest preferences */
  98.     UBYTE pd_PWaitEnabled;        /* wait function switch */
  99.     /* new fields for V2.0 */
  100.     UBYTE pd_Flags1;        /* padding */
  101.     UBYTE pd_Stk[P_STKSIZE];    /* stack space */
  102. };
  103.  
  104. /* Printer Class */
  105. #define PPCB_GFX    0    /* graphics (bit position) */
  106. #define PPCF_GFX    0x1    /* graphics (and/or flag) */
  107. #define PPCB_COLOR    1    /* color (bit position) */
  108. #define PPCF_COLOR    0x2    /* color (and/or flag) */
  109.  
  110. #define PPC_BWALPHA    0x00    /* black&white alphanumerics */
  111. #define PPC_BWGFX    0x01    /* black&white graphics */
  112. #define PPC_COLORALPHA    0x02    /* color alphanumerics */
  113. #define PPC_COLORGFX    0x03    /* color graphics */
  114.  
  115. /* Color Class */
  116. #define    PCC_BW        0x01    /* black&white only */
  117. #define    PCC_YMC        0x02    /* yellow/magenta/cyan only */
  118. #define    PCC_YMC_BW    0x03    /* yellow/magenta/cyan or black&white */
  119. #define    PCC_YMCB    0x04    /* yellow/magenta/cyan/black */
  120. #define    PCC_4COLOR    0x04    /* a flag for YMCB and BGRW */
  121. #define    PCC_ADDITIVE    0x08    /* not ymcb but blue/green/red/white */
  122. #define    PCC_WB        0x09    /* black&white only, 0 == BLACK */
  123. #define    PCC_BGR        0x0A    /* blue/green/red */
  124. #define    PCC_BGR_WB    0x0B    /* blue/green/red or black&white */
  125. #define    PCC_BGRW    0x0C    /* blue/green/red/white */
  126. /*
  127.     The picture must be scanned once for each color component, as the
  128.     printer can only define one color at a time.  ie. If 'PCC_YMC' then
  129.     first pass sends all 'Y' info to printer, second pass sends all 'M'
  130.     info, and third pass sends all C info to printer.  The CalComp
  131.     PlotMaster is an example of this type of printer.
  132. */
  133. #define PCC_MULTI_PASS    0x10    /* see explanation above */
  134.  
  135. struct PrinterExtendedData {
  136.     char    *ped_PrinterName;    /* printer name, null terminated */
  137.     VOID    (*ped_Init)();         /* called after LoadSeg */
  138.     VOID    (*ped_Expunge)();    /* called before UnLoadSeg */
  139.     int    (*ped_Open)();         /* called at OpenDevice */
  140.     VOID    (*ped_Close)();      /* called at CloseDevice */
  141.     UBYTE    ped_PrinterClass;    /* printer class */
  142.     UBYTE    ped_ColorClass;      /* color class */
  143.     UBYTE    ped_MaxColumns;      /* number of print columns available */
  144.     UBYTE    ped_NumCharSets;     /* number of character sets */
  145.     UWORD    ped_NumRows;         /* number of 'pins' in print head */
  146.     ULONG    ped_MaxXDots;         /* number of dots max in a raster dump */
  147.     ULONG    ped_MaxYDots;         /* number of dots max in a raster dump */
  148.     UWORD    ped_XDotsInch;         /* horizontal dot density */
  149.     UWORD    ped_YDotsInch;         /* vertical dot density */
  150.     char    ***ped_Commands;     /* printer text command table */
  151.     int    (*ped_DoSpecial)();  /* special command handler */
  152.     int    (*ped_Render)();     /* raster render function */
  153.     LONG    ped_TimeoutSecs;     /* good write timeout */
  154.     /* the following only exists if the segment version is >= 33 */
  155.     char    **ped_8BitChars;     /* conv. strings for the extended font */
  156.     LONG    ped_PrintMode;         /* set if text printed, otherwise 0 */
  157.     /* the following only exists if the segment version is >= 34 */
  158.     /* ptr to conversion function for all chars */
  159.     int    (*ped_ConvFunc)();
  160. };
  161.  
  162. struct PrinterSegment {
  163.     ULONG   ps_NextSegment;     /* (actually a BPTR) */
  164.     ULONG   ps_runAlert;     /* MOVEQ #0,D0 : RTS */
  165.     UWORD   ps_Version;     /* segment version */
  166.     UWORD   ps_Revision;     /* segment revision */
  167.     struct  PrinterExtendedData ps_PED;   /* printer extended data */
  168. };
  169. #endif
  170.